#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

////////////////////////////////////////
//
//  [dfk] The structure that will contain all the globals
//  For each instance of a node, there will be an instance of the  structure
//  DVN will keep track of each node/memory pointer pair
//
////////////////////////////////////////
struct kad_node_mem_t {
	void *instance;
};

/*
// The DVN callback should call this function
// It should contain all the initialization code from the main() routine
*/
void kademliaMain_init(
					   char* addr, 
					   char* port,
					   int bootstrap_needed,
					   uint32_t bootstrap_addr,
					   uint16_t bootstrap_port,
					   void** curNodeMem     /* The address of the pointer that DVN keeps for each node */
					   );

/*
// The DVN callback when there is an incoming packet
// It should do the processing of packets the way it was done in the main() routine
*/
void kademliaMain_onrecv(
						 void* modmem,			 		    
						 unsigned char* inBuf, 
						 int inBufLen, 
						 unsigned long int src_ip,
						 unsigned int src_port
						 );

int kademliaMain_onProcess(
						   void* modmem,
						   time_t curTime
						   );

void kademliaMain_onDestroy(void *modmem, time_t curTime);

#ifdef __cplusplus
} /* extern "C" */
#endif
